package test

import grails.spring.BeanBuilder
import bankofficegrepper.BankInfo

/**
 * Created by IntelliJ IDEA.
 * User: janexie
 * Date: 2010-11-27
 * Time: 17:05:50
 * To change this template use File | Settings | File Templates.
 */
class GORMTestCase extends GroovyTestCase {
  public void testGORM() {
    def gormEnvBeanBuilber = new BeanBuilder()
    gormEnvBeanBuilber.beans {
      xmlns gorm: "http://grails.org/schema/gorm"

      dataSource(org.apache.commons.dbcp.BasicDataSource) {
        url = "jdbc:mysql://localhost:3306/bankoffice"
        password = "root"
        username = "root"
        driverClassName = "com.mysql.jdbc.Driver"
      }

      hibernateProperties(String, """
  hibernate.show_sql=true
  hibernate.hbm2ddl.auto=update
  """)

      gorm {
        sessionFactory(
                "base-package": "bankofficegrepper",
                "data-source-ref": "dataSource") {
          property(name: "hibernateProperties", ref: "hibernateProperties")
        }
      }
    }
    gormEnvBeanBuilber.createApplicationContext()
    BankInfo bi =new BankInfo([province:'上海',city:'上海',type:'1',name:'leo',address:'aaa',telephoneNo:'123456',serviceTime:'aaa'])
bi.save()
  }
}
